function imIn = imsetborder(imIn, b, v)

imIn = impad(imIn, b);
[r,c,d]=size(imIn);

if d ~= length(v),
    error('size of v different than size of imIn')
end

% top 
imIn(:, 1:b, 1) = v(1);
imIn(:, 1:b, 2) = v(2);
imIn(:, 1:b, 3) = v(3);

% left
imIn(1:b, :, 1) = v(1);
imIn(1:b, :, 2) = v(2);
imIn(1:b, :, 3) = v(3);

% bottom
imIn(r-b:r, :, 1) = v(1);
imIn(r-b:r, :, 2) = v(2);
imIn(r-b:r, :, 3) = v(3);

% right
imIn(:, c-b:c, 1) = v(1);
imIn(:, c-b:c, 2) = v(2);
imIn(:, c-b:c, 3) = v(3);
